<?php

namespace common\models;

use Yii;

/**
 * This is the model class for table "{{%feddback}}".
 *
 * @property integer $id
 * @property string $type
 * @property integer $user_id
 * @property string $user_name
 * @property string $mobile
 * @property string $email
 * @property string $content
 * @property string $field1
 * @property string $field2
 * @property string $field3
 * @property string $field4
 * @property integer $status
 * @property integer $version
 * @property string $created_by
 * @property integer $created_at
 * @property string $created_from
 * @property string $created_ip
 * @property string $updated_by
 * @property integer $updated_at
 * @property string $updated_from
 * @property string $updated_ip
 * @property integer $is_deleted
 */
class Feedback extends \common\base\BaseActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return '{{%feedback}}';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['type', 'user_name', 'mobile', 'email', 'content'], 'required'],
            [['user_id', 'status', 'version', 'created_at', 'updated_at', 'is_deleted'], 'integer'],
            [['content'], 'string'],
            [['type', 'user_name', 'created_by', 'created_from', 'created_ip', 'updated_by', 'updated_from', 'updated_ip'], 'string', 'max' => 50],
            [['mobile'], 'string', 'max' => 30],
            ['mobile', 'match', 'pattern' => '/^1\d{10}$/', 'message' => '{attribute}格式错误'],
            ['email', 'email'],
            [['email', 'field1', 'field2', 'field3', 'field4'], 'string', 'max' => 100],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => Yii::t('common', 'id'),
            'type' => Yii::t('common', 'type'),
            'user_id' => Yii::t('common', 'user_id'),
            'user_name' => Yii::t('common', 'user_name'),
            'mobile' => Yii::t('common', 'mobile'),
            'email' => Yii::t('common', 'email'),
            'content' => Yii::t('common', 'content'),
            'field1' => Yii::t('common', 'field1'),
            'field2' => Yii::t('common', 'field2'),
            'field3' => Yii::t('common', 'field3'),
            'field4' => Yii::t('common', 'field4'),
            'status' => Yii::t('common', 'status'),
            'version' => Yii::t('common', 'version'),
            'created_by' => Yii::t('common', 'created_by'),
            'created_at' => Yii::t('common', 'created_at'),
            'created_from' => Yii::t('common', 'created_from'),
            'created_ip' => Yii::t('common', 'created_ip'),
            'updated_by' => Yii::t('common', 'updated_by'),
            'updated_at' => Yii::t('common', 'updated_at'),
            'updated_from' => Yii::t('common', 'updated_from'),
            'updated_ip' => Yii::t('common', 'updated_ip'),
            'is_deleted' => Yii::t('common', 'is_deleted'),
        ];
    }
}
